package com.cmb.lk50.common.extractor;

import com.google.common.base.Joiner;
import org.springframework.http.server.reactive.ServerHttpRequest;

import javax.servlet.http.HttpServletRequest;

/**
 * Author       : 蒋俊钊 80256973
 * Date         : 2019/11/13
 * Copyright    (C) ChinaMerchantsBank
 */
public class UrlParamExtractor extends QueryParamExtractor {

    @Override
    public String extract(HttpServletRequest request) {
        return request.getQueryString();
    }

    @Override
    public String extract(ServerHttpRequest request) {
        Joiner.MapJoiner joiner = Joiner.on("&").withKeyValueSeparator("=");
        return joiner.join(request.getQueryParams());
    }
}
